package cn.sunshine.framework.beans.factory.support;

import cn.sunshine.framework.core.io.DefaultResourceLoader;
import cn.sunshine.framework.core.io.ResourceLoader;

/**
 * @Description 抽像 DefinitionReader 聚合需要的公共成员, 具体实现规范的操作交由后面具体的子类处理
 * @Author Mokairui
 * @Since 2021/12/11
 */
public abstract class AbstractBeanDefinitionReader implements BeanDefinitionReader {

    private final BeanDefinitionRegistry registry;

    private ResourceLoader resourceLoader;

    public AbstractBeanDefinitionReader(BeanDefinitionRegistry registry) {
        this(registry, new DefaultResourceLoader());
    }

    public AbstractBeanDefinitionReader(BeanDefinitionRegistry registry, ResourceLoader resourceLoader) {
        this.registry = registry;
        this.resourceLoader = resourceLoader;
    }

    @Override
    public BeanDefinitionRegistry getRegistry() {
        return registry;
    }

    @Override
    public ResourceLoader getResourceLoader() {
        return resourceLoader;
    }
}
